package org.mog.music.service;

import dto.MusicInsertDTO;
import dto.MusicLikeDTO;
import dto.MusicPageDTO;
import dto.MusicSearchDTO;
import entity.resullt.PageResult;
import entity.resullt.Result;
import org.springframework.stereotype.Service;
import vo.MusicPageVO;

import javax.servlet.http.HttpServletRequest;
import java.io.IOException;
import java.net.MalformedURLException;

public interface IMusicService {
    /**
     * 获取音乐分页数据
     *
     * @param musicPageDTO
     * @return
     */
    PageResult<MusicPageVO> getMusicPage(MusicPageDTO musicPageDTO);

    /**
     * 新增音乐
     *
     * @param musicInsertDTO
     */
    void insertMusic(MusicInsertDTO musicInsertDTO, HttpServletRequest request, Long userId);

    /**
     * 搜索音乐
     *
     * @param musicSearchDTO
     * @return
     */
    PageResult<MusicPageVO> searchMusic(MusicSearchDTO musicSearchDTO);

    /**
     * 服务器内搜索音乐
     *
     * @param musicSearchDTO
     * @return
     */
    PageResult<MusicPageVO> localSearch(MusicSearchDTO musicSearchDTO);

    /**
     * 下载或播放音乐
     *
     * @param page
     * @param pageSize
     * @param n
     * @return
     */
    String playOrDownloadMusic(Integer page, Integer pageSize, String keyword, Integer n, HttpServletRequest request) throws Exception;

    /**
     * 上传文件到文件系统(minio)
     *
     * @return
     */
    String upload2FS(MusicInsertDTO dto) throws Exception;

    /**
     * 增加播放次数
     *
     * @param id
     */
    Result addPlays(Long id);
}
